//
//  WWAppliersCell.m
//  快医
//
//  Created by 孙博 on 16/7/7.
//
//

#import "WWAppliersCell.h"

@interface WWAppliersCell ()

// lb_name
@property (nonatomic, weak)UILabel *lb_name;
// lb_illness
@property (nonatomic, weak)UILabel *lb_illness;
// lb_time
@property (nonatomic, weak)UILabel *lb_time;
// lb_long
@property (nonatomic, weak)UILabel *lb_long;
// lineView
@property (nonatomic, weak)UIView *lineView;
// lb_status
@property (nonatomic, weak)UILabel *lb_status;
// btn
@property (nonatomic, weak)UIButton *btn;

@end

@implementation WWAppliersCell

- (void)awakeFromNib {

    
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
    }
    return self;
}

- (void)setModel:(WWAppliersModel *)model{
    _model = model;
    [self setupUI];
    self.lb_name.text = model.name;
    self.lb_illness.text = model.illness;
    if (model.status) {
        self.lb_status.text = @"已就诊";
    }else{
        self.lb_status.text = @"审核中";
    }
    [self setupLay];
}

//product_button_input_jianjiao.png
#pragma
#pragma mark -设置cell内容
- (void)setupUI{
    
    // lb_name
    UILabel *lb_name = [UILabel new];
    [self.contentView addSubview:lb_name];
    lb_name.font = [UIFont systemFontOfSize:14];
    self.lb_name = lb_name;
    
    // lb_illness
    UILabel *lb_illness = [UILabel new];
    [self.contentView addSubview:lb_illness];
    lb_illness.font = [UIFont systemFontOfSize:14];
    self.lb_illness = lb_illness;
    
    // lb_time
    UILabel *lb_time = [UILabel new];
    [self.contentView addSubview:lb_time];
    lb_time.text = @"就诊时间:2016/06/19";
    lb_time.font = [UIFont systemFontOfSize:14];
    self.lb_time = lb_time;
    
    // lb_long
    UILabel *lb_long = [UILabel new];
    [self.contentView addSubview:lb_long];
    lb_long.text = @"马医生  主任医生\t\t上海精神病院";
    lb_long.font = [UIFont systemFontOfSize:14];
    self.lb_long = lb_long;
    
    // lineView
    UIView *lineView = [[UIView alloc]init];
    [self.contentView addSubview:lineView];
    lineView.backgroundColor = [UIColor grayColor];
    self.lineView = lineView;
    
    // lb_status
    UILabel *lb_status = [UILabel new];
    [self.contentView addSubview:lb_status];
    [lb_status setBackgroundColor:XHRThemeColor];
    lb_status.font = [UIFont systemFontOfSize:14];
    lb_status.layer.cornerRadius = 25;
    lb_status.layer.masksToBounds = YES;
    lb_status.textAlignment = NSTextAlignmentCenter;
    self.lb_status = lb_status;
    
    // btn
    UIButton *btn = [[UIButton alloc]init];
    [self.contentView addSubview:btn];
    [btn setImage:[UIImage imageNamed:@"product_button_input_jianjiao.png"] forState:UIControlStateNormal];
    self.btn = btn;
}

- (void)setupLay{
    // lb_name
   [self.lb_name makeConstraints:^(MASConstraintMaker *make) {
       make.leading.equalTo(10);
       make.top.equalTo(8);
   }];
    
    // lb_illness
    [self.lb_illness makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(self.lb_name.trailing).offset(5);
        make.top.equalTo(8);
    }];
    
    // lb_time
    [self.lb_time makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(self.lb_illness.trailing).offset(10);
        make.top.equalTo(8);
    }];
    
    // btn
    [self.btn makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.equalTo(-10);
        make.width.height.equalTo(15);
        make.centerY.equalTo(self.centerY);
    }];
    
    // lb_status
    [self.lb_status makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.equalTo(self.btn.leading).offset(-5);
        make.width.height.equalTo(50);
        make.centerY.equalTo(self.centerY);
    }];
    
    // lineView
    [self.lineView makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(10);
        make.centerY.equalTo(self.centerY);
        make.trailing.equalTo(self.lb_status.leading);
        make.height.equalTo(2);
    }];
    
    // lb_long
    [self.lb_long makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.lineView.bottom).offset(5);
        make.leading.equalTo(10);
    }];
}

// MARK:  设置行高


@end
